package com.xh.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import javax.servlet.MultipartConfigElement;

/**
 * @Name UploadFileConfig
 * @Description
 * @Author wen
 * @Date 2019-05-06
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Value("${fileUpload.rootSavePath}")
    private String rootSavePath;
    @Value("${fileUpload.accessory.path}")
    private String accessoryPath;
    @Value("${fileUpload.accessoryPrefix}")
    private String accessoryMappingPrefix;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler(accessoryPath).addResourceLocations(accessoryMappingPrefix + rootSavePath);
    }


}
